package com.zf.generator.bean;

import org.apache.commons.lang.StringUtils;
import org.eclipse.jdt.core.ICompilationUnit;

public class ClassNameInfo {
	private String entityClassName;

	public ClassNameInfo(ICompilationUnit compilationUnit) {
		String entityFileName = compilationUnit.getElementName();
		this.entityClassName = entityFileName.substring(0, entityFileName
				.lastIndexOf("."));// entity类名
	}

	public ClassNameInfo(String entityFullName) {
		this.entityClassName = entityFullName.substring(0, entityFullName
				.lastIndexOf("."));// entity类名
		this.entityClassName = entityClassName.substring(entityClassName
				.lastIndexOf(".") + 1, entityClassName.length());// entity类名
	}

	/**
	 * 实体类名称
	 * 
	 * @return
	 */
	public String getEntityClassName() {
		return entityClassName;
	}

	/**
	 * 实体对象名称
	 * 
	 * @return
	 */
	public String getEntityObjectName() {
		return StringUtils.uncapitalize(entityClassName);
	}

	/**
	 * dao类名称
	 * 
	 * @return
	 */
	public String getDaoClassName() {
		return entityClassName + "Dao";
	}

	/**
	 * dao对象名称
	 * 
	 * @return
	 */
	public String getDaoObjectName() {
		return StringUtils.uncapitalize(entityClassName + "Dao");
	}

	/**
	 * service类名称
	 * 
	 * @return
	 */
	public String getServicClassName() {
		return entityClassName + "Service";
	}

	/**
	 * service对象名称
	 * 
	 * @return
	 */
	public String getServicObjectName() {
		return StringUtils.uncapitalize(entityClassName + "Service");
	}

	/**
	 * action类名称
	 * 
	 * @return
	 */
	public String getActionClassName() {
		return entityClassName + "Action";
	}

	/**
	 * action对象名称
	 * 
	 * @return
	 */
	public String getActionObjectName() {
		return StringUtils.uncapitalize(entityClassName + "Action");
	}

}
